When you and another person have a similar interest, fear, friend, or wish — anything at all, really — you have that thing in common.
To have something in common with another person forms a connection between the two of you, something you share equally. If you and your best friend have a fear of spiders in common, it means that your phobia is something the two of you share. The oldest meaning of the adjective common is "shared by, coming from, or done by more than one," and it's this definition that led to the phrase in common.